﻿using PracticeCentre.Business;
using PracticeCentre.Common;
using PracticeCentre.Modeles;
using PracticeCentre.Mvc.Filters;
using PracticeCentre.Mvc.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PracticeCentre.Mvc.Controllers
{
    public class MainController : BaseController
    {
        private JsonResult result;
        [LoginIntercept]
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        [LoginIntercept]
        public ActionResult LeftMenu()
        {
            SystemUser loginUser = Session["userInfo"] as SystemUser;
            //根据登录用户获取拥有的菜单
            NavigationMenu menuList = new NavigationMenu();
            List<Menu> menus = menuList.GetLoginUserMenuList(loginUser);
            result = DataHelper.GetResult(ExecuteState.Succeed, "登录成功,正在进入系统，请稍等...", JsonTool.JsonSerializer(menus));
            return result;
        }

    }
}